home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / misc / GMSV03B.lha / GamesMaster / Source / Asm / ScreenDemos / FadingDemo.s < prev    next >
Encoding:
Text File  |  1996-09-12  |  4.3 KB  |  150 lines

  1. ;Fade Demo
  2. ;---------
  3. ;There are three examples of fading in this program:  Fade_To_White,
  4. ;Fade_To_Palette, and Fade_To_Black.
  5. ;
  6. ;Press fire to see the end of the fade sequence.
  7.  
  8.     opt    o+
  9.  
  10.     INCLUDE    "exec/exec_lib.i"
  11.     INCLUDE    "games/games_lib.i"
  12.     INCLUDE    "games/games.i
  13.  
  14. CALL    MACRO
  15.     jsr    _LVO\1(a6)
  16.     ENDM
  17.  
  18.     SECTION    "FadingDemo",CODE
  19.  
  20. ;===========================================================================;
  21. ;                             INITIALISE DEMO
  22. ;===========================================================================;
  23.  
  24. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  25.     move.l    ($4).w,a6
  26.     lea    GMS_Name(pc),a1
  27.     moveq    #$00,d0
  28.     CALL    OpenLibrary
  29.     move.l    d0,GMS_Base
  30.     beq    Quit
  31.  
  32.     move.l    GMS_Base(pc),a6
  33.     CALL    SetUserPri
  34.  
  35.     move.l    GMS_Base(pc),a6          ;Tell GMS that we want to add a
  36.     lea    ScreenStruct(pc),a0      ;screen for use.
  37.     CALL    Add_Screen
  38.     tst.l    d0
  39.     bne.s    Error
  40.  
  41.     lea    Picture(pc),a1           ;a1 = Picture struct.
  42.     move.l    SS_MemPtr1(a0),PIC_Data(a1)
  43.     lea    PicFile(pc),a0           ;a0 = Picture file.
  44.     CALL    LoadPic
  45.     tst.w    d0
  46.     bne.s    ReturnToDOS
  47.  
  48.     lea    ScreenStruct(pc),a0      ;Now show the screen/pic.
  49.     CALL    Show_Screen
  50.  
  51. ;===========================================================================;
  52. ;                                MAIN CODE
  53. ;===========================================================================;
  54.  
  55.     moveq    #30,d0
  56.     CALL    Wait_Time
  57.  
  58.     moveq    #00,d0                   ;d0 = Initialise fader.
  59.     moveq    #00,d1                   ;d1 = Start at colour zero.
  60.     moveq    #16,d2                   ;d2 = Amount of colours (32)
  61.     lea    Palette(pc),a1
  62. .Fade    CALL    Wait_VBL
  63.     CALL    Wait_OSVBL
  64.     CALL    B12_FadeToPalette
  65.     tst.w    d0
  66.     bne.s    .Fade
  67.  
  68.     CALL    Wait_LMB
  69.  
  70.     moveq    #00,d0                   ;This is the fade loop.  It will
  71.     moveq    #00,d1
  72.     moveq    #16,d2                   ;are white).  Notice the start
  73. .Fade1    CALL    Wait_OSVBL               ;keep on looping until all colours
  74.     CALL    B12_FadeToWhite          ;colour is 00 and the amt of
  75.     tst.w    d0                       ;colours is 32, so that all the
  76.     bne.s    .Fade1                   ;cols are included in the range.
  77.  
  78.     moveq    #30,d0
  79.     CALL    Wait_Time
  80.  
  81.     moveq    #$00,d0                  ;Now we fade down to black. Note
  82. .Fade2    CALL    Wait_OSVBL               ;that we have calld Initialise_Fader
  83.     CALL    B12_FadeToBlack          ;every time - otherwise each fade
  84.     tst.w    d0                       ;would not even attempt to start!
  85.     bne.s    .Fade2                   ;Also of interest is that Fading
  86.                                  ;to Black covers ALL colours.
  87.     moveq    #50,d0
  88.     CALL    Wait_Time
  89.  
  90. ;===========================================================================;
  91. ;                              RETURN TO DOS
  92. ;===========================================================================;
  93.  
  94. ReturnToDOS:
  95.     move.l    GMS_Base(pc),a6
  96.     lea    ScreenStruct(pc),a0
  97.     CALL    Delete_Screen            ;Give back screen memory etc.
  98. Error    move.l    GMS_Base(pc),a1
  99.     move.l    ($4).w,a6
  100.     CALL    CloseLibrary
  101. Quit    MOVEM.L    (SP)+,A0-A6/D1-D7
  102.     moveq    #$00,d0
  103.     rts
  104.  
  105. ;===========================================================================;
  106. ;                                  DATA
  107. ;===========================================================================;
  108.  
  109. GMS_Name:
  110.     dc.b    "games.library",0
  111.     even
  112. GMS_Base:
  113.     dc.l    0
  114.  
  115. AMT_PLANES =    4
  116.  
  117. ScreenStruct:
  118.     dc.l    "GSV1",0
  119.     dc.l    0,0,0             ;Screen_Mem1/2/3
  120.     dc.l    0                 ;Screen link.
  121.     dc.l    0                 ;Address of screen palette.
  122.     dc.l    0                 ;Address of rasterlist.
  123.     dc.l    0                 ;Amt of colours in palette.
  124.     dc.w    320,256,640,256   ;Screen & Pic Height/Width
  125.     dc.w    AMT_PLANES        ;Amt_Planes
  126.     dc.w    0,0               ;X/Y screen offset
  127.     dc.w    0,0               ;X/Y picture offset
  128.     dc.l    0                 ;Special attributes.
  129.     dc.w    LORES             ;Screen mode.
  130.     dc.b    INTERLEAVED       ;Screen type
  131.     dc.b    0                 ;Reserved.
  132.     even
  133.  
  134. Palette    dc.w    $0000,$0400,$0501,$0501,$0601,$0701,$0701,$0801
  135.     dc.w    $0901,$0A01,$0B02,$0432,$0CC0,$0F00,$0211,$0880
  136.  
  137. Picture    dc.l    "PCV1",0           ;Version header.
  138.     dc.l    0                  ;Source data.
  139.     dc.w    640,256            ;Width, Height.
  140.     dc.w    AMT_PLANES         ;Amount of Planes.
  141.     dc.l    32                 ;Amount of colours.
  142.     dc.l    Palette            ;Source palette (remap).
  143.     dc.w    LORES              ;Screen mode.
  144.     dc.w    INTERLEAVED        ;Destination
  145.     dc.l    0                  ;Parameters.
  146.  
  147. PicFile    dc.b    "GAMESLIB:data/IFF.Pic640x256",0
  148.     even
  149.  
  150.